<script setup>
import VTK from "./components/vtk/index.vue";
import Three from "./components/three/index.vue";
import { ref } from "vue";
let parts = [
  {
    partName: "vtk.js",
    value: 1,
  },
  {
    partName: "three.js",
    value: 2,
  },
];
let currentPart = ref(1);
function switchPart(part) {
  currentPart.value = part;
  console.log(currentPart);
}
</script>

<template>
  <div class="topBar">
    <div
      class="partItem"
      :class="{ activePart: part.value == currentPart }"
      v-for="part in parts"
      :key="part.partName"
      @click="switchPart(part.value)"
    >
      {{ part.partName }}
    </div>
  </div>
  <VTK v-if="currentPart == 1"></VTK>
  <Three v-if="currentPart == 2"></Three>
  <div></div>
</template>

<style lang="scss" scoped>
.topBar {
  height: 60px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 1px solid #ccc;
  .partItem {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 5px;
    border: 1px solid #ccc;
    padding: 5px 12px;
    cursor: pointer;
    margin-right: 10px;
  }
  .activePart {
    background-color: coral;
    color: #fff;
  }
}
</style>
